package org.holynite.fieldmanage.entities

import javax.persistence.CascadeType
import javax.persistence.Column
import javax.persistence.Entity
import javax.persistence.FetchType
import javax.persistence.Id
import javax.persistence.JoinColumn
import javax.persistence.JoinTable
import javax.persistence.ManyToMany
import javax.persistence.OneToOne
import javax.persistence.Table
import javax.persistence.Transient

/**
 * Created by midnite on 15/1/5.
 */
@Entity
@Table(name = "locker")
class Locker implements Serializable {
	@Id
	@Column(name = "locker_id")
	String lockId
	@Column(name = "bookable", nullable = false)
	Boolean bookable = true
	@Transient
	Set<CustomerType> customerTypeLimited
	@Transient
	Set<ChargeScheme> chargeSchemes
	@Transient
	LockerLeaseRecord leaseRecord = null

	boolean equals(o) {
		if (this.is(o)) return true
		if (getClass() != o.class) return false

		Locker locker = (Locker) o

		if (lockId != locker.lockId) return false

		return true
	}

	int hashCode() {
		return (lockId != null ? lockId.hashCode() : 0)
	}
}
